﻿Imports Microsoft.Win32
Public Class WinReg
    Shared ReadOnly Property HKEY_LOCAL_MACHINE() As RegistryKey
        ' obtain "true" (non-WoW) HKLM key on all platforms
        Get
            Dim RegRoot As RegistryKey
            If Environment.Is64BitOperatingSystem Then
                ' 64bit OS
                RegRoot = Registry.LocalMachine.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)
            Else
                ' 32bit OS
                RegRoot = Registry.LocalMachine.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)
            End If
            Return RegRoot
        End Get
    End Property
End Class

